﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace UpgradeLoader
{
    public class ServerUpgradeInfo
    {
        public string CurrentVersion { get; set; }

        public bool IsForceUpgrade { get; set; } = false;
        public string UpgradeZipFile { get; set; }

        public int CurrentVersionNum
        {
            get
            {
                if (string.IsNullOrWhiteSpace(CurrentVersion))
                {
                    return 0;
                }
                var temp = CurrentVersion.Replace(".", "");
                return Convert.ToInt32(temp);
            }
        }

        public string FileName
        {
            get
            {
                if(!string.IsNullOrWhiteSpace(UpgradeZipFile))
                {
                    var index = UpgradeZipFile.LastIndexOf("/");
                    if(index>=0)
                    {
                        return UpgradeZipFile.Substring(index + 1);
                    }
                }
                return "";
            }
        }

        public string SaveDir { get; internal set; }
        public string MD5 { get; internal set; }
    }
}
